package com.cskaoyan.controller;

import com.cskaoyan.bean.MarketComment;
import com.cskaoyan.bean.bo.AdminCommentListBO;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.SimpleRespVO;
import com.cskaoyan.service.AdminCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : gao
 * @since: 2022/10/13  10:08
 */
@RestController
@RequestMapping("admin/comment")
public class AdminCommentController {
    @Autowired
    AdminCommentService adminCommentService;

    @RequestMapping("list")
    public BaseRespVo<CommonData> listComment(AdminCommentListBO adminCommentListBO) {
        CommonData<MarketComment> data = adminCommentService.list(adminCommentListBO);
        return BaseRespVo.ok(data,"成功");
    }

    @RequestMapping("delete")
    public SimpleRespVO deleteComment(@RequestBody MarketComment marketComment){
        Integer id = marketComment.getId();
        adminCommentService.deleteComment(id);
        return SimpleRespVO.ok(0,"成功");
    }

}
